<template>
	<view>
		<web-view class="webview" :src="url"></web-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url: '',
				type: 1,
				private_domain: "e54212864",
			}
		},
		onLoad(option) {
			if (option.type && option.type == 2) {
				console.log(option)
				this.url =
					`https://${this.private_domain}.at.baijiayun.com/web/playback/index?classid=${option.url}&token=${option.token}`
				console.log(this.url)
			}
			if (option.type && option.type == 3) {
				let {
					room_id,
					user_number,
					user_name,
					user_role,
					user_avatar,
					sign
				} = option
				this.url =
					`https://${this.private_domain}.at.baijiayun.com/web/room/enter?room_id=${room_id}&user_number=${user_number}&user_name=${user_name}&user_role=${user_role}&user_avatar=${user_avatar}&sign=${sign}`

				console.log(this.url)
			}
			let title = option.title || '';
			uni.setNavigationBarTitle({
				title: title
			})
		}
	}
</script>
